#ifndef libc3d_0_1
#define libc3d_0_1
/*
 *  libc3d.h
 *  c3d
 *
 *  Created by Joel Brauer on 7/6/09.
 *
 */

#include <stdio.h>
#include <stdlib.h>
#include <string.h>

typedef struct _libc3d_c3dHeader {
	char		parmIdx;		/*word 1*/
	char		fileType;	
	short 	cnt3dPnts;		/*word 2*/
	short 	cntAnalogMeasure;	/*word 3*/
	short 	frstFrame;		/*word 4*/
	short		lastFrame;		/*word 5*/
	short 	maxIntrpolationGap;	/*word 6*/
	float		scaleFactor;		/*word 7-8*/
	short 	dataStart;		/*word 9*/
	short 	cntAnalogSamples;	/*word 10*/
	float 	frameRate;		/*word 11-12*/
	short 	reserved[135];		/*word 13-147 */
	short		labelAndRangeInd;	/*word 148 */
	short		labelAndRangeStrt;	/*word 149 */
	short		fourCharLabelsInd;	/*word 150 */
	short		cntTimeEvents;		/*word 151 */
	short		reserved1;		/*word 152 */
	float		eventTimes[18];		/*word 153-188*/
	char		eventDispFlags[18];	/*word 189-197*/
	short		reserved2;		/*word 198*/
	char		eventLabls[18][4];	/*word 199-234*/
	short		reserved3[22];		/*word 235-256*/
} libc3d_c3dHeader;

typedef struct _libc3d_paramInfo
{
	char *fullname;	//name of parameter to look for
	char *group; //group that parameter is in
	char *name; //name of the actual parameter
	char type; //size of the parameter (-1 =char)
	char dim; // number of dimensions
	char *dimSizes; // sizes of each dimension
	void *data; // pointer to the start of the data
	int dataSize; // count of objects (ie dimSizes multiplied by eachother and type)
	char *desc; //description of the parameter
} libc3d_paramInfo;

typedef struct _libc3d_data
{
	float x; //x coordinate for data record
	float y; //y coordinate for data record
	float z; //z coordinate for data record
	int flags; //hold flags for data record
} libc3d_data;
// functions
int libc3d_init(char* filename);
int libc3d_close();
int libc3d_loadParameters();
int libc3d_getParameter (libc3d_paramInfo *);
char libc3d_getParmType(void *);
char libc3d_getParmDimCnt(void *);
int libc3d_freeParmInfo (libc3d_paramInfo *);
int libc3d_readData(); 
void libc3d_dimensionSwap(libc3d_paramInfo *parm);
int libc3d_read_labels();
//variables
libc3d_c3dHeader* libc3d_header;
void * libc3d_parameters;
short libc3d_procType; //1-intel, 2-DEC, 3-MIPS
FILE *libc3d_fp;
int libc3d_PointCnt, libc3d_AnalogCnt;
char** libc3d_pointLabels;
char** libc3d_analogLabels;
libc3d_data* libc3d_datarow;
int libc3d_startLoc;
short libc3d_dataf, libc3d_readSize=0;
int libc3d_EOF = 0;

#endif
